package br.com.async.domain.reserve;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Transient;

import br.com.async.domain.AgileRoomEntity;

@Entity(name = "tb_time")
public class Time implements AgileRoomEntity<Integer> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	public static final String A = "A";
	public static final String B = "B";
	public static final String C = "C";
	public static final String D = "D";

	@Id
	private Integer code;
	private String name;
	
	@Transient
	private boolean free = true;

	public Time() {

	}
	
	public Time(Integer code, String name){
		this.code = code;
		this.name = name;
	}

	public Integer getCode() {
		return code;
	}

	public void setCode(Integer code) {
		this.code = code;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	public boolean isFree() {
		return free;
	}
	
	public boolean getFree() {
		return free;
	}

	public void setFree(boolean free) {
		this.free = free;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((code == null) ? 0 : code.hashCode());
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Time other = (Time) obj;
		if (code == null) {
			if (other.code != null)
				return false;
		} else if (!code.equals(other.code))
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		return true;
	}
	
	public static List<Time> listTime(){
		List<Time> listTime = new ArrayList<Time>();
		
		listTime.add(new Time(1, Time.A));
		listTime.add(new Time(2, Time.B));
		listTime.add(new Time(3, Time.C));
		listTime.add(new Time(4, Time.D));
		
		return listTime;
	}

}